package com.airspyar;

import java.net.URL;
import java.net.URLConnection;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class DetailedFlightState extends FlightState {
	
	private final JSONFlightState detailedInfo;
	private Bitmap bitmap=null;

	
	public DetailedFlightState(FlightState state, JSONFlightState detailedInfo){
		super(state);
		this.detailedInfo=detailedInfo;
	}
	
	public void setBitmap(Bitmap bitmap){
		this.bitmap=bitmap;
	}
	
	public void loadBitmap() throws Exception{		
		URL url=new URL(detailedInfo.getImg());
		URLConnection connection=url.openConnection();
		connection.setConnectTimeout(2000);
		connection.setReadTimeout(3000);
		bitmap=BitmapFactory.decodeStream(connection.getInputStream());
	}
	
	public String getFrom(){
		return detailedInfo.getFrom();
	}
	
	public String getTo(){
		return detailedInfo.getTo();
	}	
	
	public String getAirline(){
		return detailedInfo.getAirline();
	}	
	
	public String getAircraft(){
		return detailedInfo.getAircraft();
	}	
	
	public String getAuthor(){
		return detailedInfo.getAuthor();
	}
	
	public String getBigImageUrl(){
		return detailedInfo.getImgBig();
	}
	
	public Bitmap getBitmap(){
		return bitmap;
	}	
}
